package AbstractFactory;

import org.junit.Test;

public class ApiTest {
    @Test
    public void abstractFactory(){
        String os = "Mac";
        GuiFactory factory;
        if(os.equals("Windows")){
            factory = new WinFactory();
        } else if(os.equals("Mac")){
            factory = new MacFactory();
        }else {
            throw new RuntimeException("错误！未知的操作系统。");
        }
        Application app = new Application(factory);
        app.createUI();
    }
}
